package project.teg.views;

import project.teg.common.types.ScreenType;
import project.teg.configuration.Global;
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;

public class GameView extends View implements OnTouchListener {

	public GameView(Context context) {
		super(context);

		this.setOnTouchListener(this);
		screenType = ScreenType.WelcomeScreen;
	}

	public GameView(Context context, AttributeSet attrs) {
		super(context, attrs);
		this.setOnTouchListener(this);
		screenType = ScreenType.WelcomeScreen;
	}

	ScreenType screenType = ScreenType.WelcomeScreen;

	@Override
	public synchronized boolean onTouch(View v, MotionEvent event) {
//		Log.e("onTouch", "Poziv");
//		if (event.getAction() == MotionEvent.ACTION_DOWN)
//			screenType = Global.currentGame.OnTouch_Down(this, screenType);
//		else if (event.getAction() == MotionEvent.ACTION_UP)
//			screenType = Global.currentGame.OnTouch_Up(this, screenType);
//		else if (event.getAction() == MotionEvent.ACTION_MOVE)
//			screenType = Global.currentGame.OnTouch_Move(this, screenType);
//		else if (screenType == ScreenType.GameOverScreen) {
//		}
		return true;
	}

	@Override
	protected synchronized void onDraw(Canvas canvas) {

//		Log.e("OnDraw", "Poziv");
//		if (screenType == ScreenType.WelcomeScreen) {
//			Global.currentGame.ShowWelcomeScreen(canvas);
//		} else if (screenType == ScreenType.NextLevel) {
//			Global.currentGame.ShowNextLevel(canvas);
//			Global.currentGame.ShowInfo(canvas);
//		} else if (screenType == ScreenType.GameOverScreen) {
//			Global.currentGame.ShowGameOverScreen(canvas);
//		} else if (screenType == ScreenType.SameLevel) {
//			Global.currentGame.ShowSameLevel(canvas);
//			Global.currentGame.ShowInfo(canvas);
//		}
	}
}
